<extend name="Home@Base/common" xmlns="http://www.w3.org/1999/html"/>
<block name="body">
    <div class="span9 page_message">
        <section id="contents"> <include file="Home@Addons/_nav" />
            <div class="tab-content">
                <php> $post_url || $post_url = U('ordermanage?model='.$model['id'], $get_param);</php>
                <form class="form-horizontal form-center" method="post" action="{$post_url}" id="form">
                    <div class="form-item cf">
                        <label class="item-label"><span style="font-weight: bold">查询条件: &nbsp&nbsp</span></label>
                        <span>从</span>
                        <span><input type="datetime" name="start_date" class="date"  placeholder="请选择日期" value="{$data.start_date}"/></span>
                        <span> 到</span>
                        <span><input type="datetime" name="end_date" class="date"  placeholder="请选择日期" value="{$data.end_date}"/></span>
                        <div>
                            <span>统计类型 ： </span>
                            <select name="status" style="width: 200px;height: 26px;padding-top: 0px">
                                <volist name="status_sel" id="vo">
                                    <option value="{$vo.id}" {$vo.selected}>{$vo.name}</option>
                                </volist>
                            </select>
                            <button style="margin-left: 30px;margin-top: 3px; width: 120px;height: 30px background-color: #327cd5; value='1' name="button_query">开始统计</button>
                        </div>
                        <br>
                    </div>
                    <!--
                    <div class="form-item cf" style="float: left">
                        <span> 统计类型</span>
                        <select name="status" style="width: 120px;height: 26px;padding-top: 0px">
                            <volist name="status_sel" id="vo">
                                <option value="{$vo.id}" {$vo.selected}>{$vo.name}</option>
                            </volist>
                        </select>
                    </div>
                    -->
                </form>
                    <div style="clear: left">
                        <hr>
                    </div>
                <div style="margin-bottom: 50px"><button onclick="windprint()">打 印</button></div>
                <div id="print_body" style="width: 100%">
                <table>
                    <thead><tr>
                        <volist name="table_name" id="vo" mode="5">
                            <th>{$vo}</th>
                        </volist>
                    </tr></thead>
                    <tr>
                    <volist name="table_data" id="vo">
                        <tr>
                            <volist name="vo" id="item">
                                <php>
                                    if(empty($item["style"])){
                                        echo '<td>'.$item.'</td>';
                                    }else{
                                        echo '<td style="'.$item["style"].'">'.$item["data"].'</td>';
                                    }
                                </php>

                            </volist>
                        </tr>
                    </volist>
                    </tr>
                </table>
                </div>
                <div class="page"> {$_page|default=''} </div>
                <div><input type="hidden" name="type" value="{$type}"></div>
                <!--</form>-->
            </div>
        </section>
    </div>
</block>

<block name="style">
    <style type="text/css">
        table {
            width: 100%;
            border-collapse: collapse;
            margin: 0 auto;
            text-align: center;
        }
        table td, table th {
            border: 0px solid #cad9ea;
            color: #666;
            height: 30px;
            text-align: center;
        }
        table thead th {
            background-color: #CCE8EB;
            width: 100px;
        }
        table tr:nth-child(odd) {
            background: #fff;
        }
        table tr:nth-child(even) {
            background: #F5FAFA;
        }
    </style>
</block>

<block name="script">
    <link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
    <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">

    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js?v={:SITE_VERSION}" charset="UTF-8"></script>
    <script type="text/javascript" src="__STATIC__/jquery-migrate-1.2.1.min.js"></script>
    <script type="text/javascript" src="__STATIC__/jquery.jqprint-0.3.js"></script>
    <script type="text/javascript">
        var HKEY_Root, HKEY_Path, HKEY_Key;
        HKEY_Root = "HKEY_CURRENT_USER";
        HKEY_Path = "\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
        $(function() {
            $('.date').datetimepicker({
                format: 'yyyy-mm-dd',
                language: "zh-CN",
                minView: 2,
                autoclose: true
            });
            showTab();
        });

        function windprint() {
            pagesetup_null();
            var isIE = /msie/.test(navigator.userAgent.toLowerCase()); //jquery1.9之后采用
            if (isIE) {
                ieprint('print_body');
            }else{
                $("#print_body").jqprint();
            }
        }
        function pagesetup_null(){
            try{
                var RegWsh = new ActiveXObject("WScript.Shell")
                hkey_key="header"
                RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"")
                hkey_key="footer"
                RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"")
            }catch(e){}
        }

        function ieprint(mydiv)
        {
            var newstr = document.getElementById(mydiv).innerHTML;
            window.document.body.innerHTML=newstr
            window.print();
        }

    </script>
</block>